/**
 * 1
 *  
 * @Author : roryrywang
 * @DateTime : 2024/8/23 18:49
 */

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

struct ListNode {
    int val;
    struct ListNode *next;

    ListNode(int x) : val(x), next(nullptr) {}

    ListNode(int x, ListNode *next) : val(x), next(next) {}
};


class Solution {
public:
    /**
     * 代码中的类名、方法名、参数名已经指定，请勿修改，直接返回方法规定的值即可
     *
     *
     * @param a ListNode类
     * @return int整型
     */
    int merge(ListNode *a) {
        ListNode *p = a;
        ListNode *s = a->next;
        int res = 0;
        while (s != nullptr) {
            if ((p->val == 0 && s->val == 0) || (p->val != 0 && s->val != 0)) {
                res++;
            }
            p = p->next;
            s = s->next;
        }
        return res;
    }
};

int main() {
    Solution sl;
    ListNode *node = new ListNode(0, new ListNode(0, new ListNode(1, new ListNode(1, nullptr))));
    cout << sl.merge(node);
    return 0;
}